# Contributor: Matthias Ahouansou <matthias@ahouansou.cz>
# Maintainer: Matthias Ahouansou <matthias@ahouansou.cz>
pkgname=tree-sitter-xml
pkgver=0.6.4
pkgrel=0
pkgdesc="XML & DTD grammars for tree-sitter"
url="https://github.com/ObserverOfTime/tree-sitter-xml"
arch="all"
license="MIT"
makedepends="tree-sitter-dev"
subpackages="$pkgname-doc"
provides="tree-sitter-dtd=$pkgver-r$pkgrel"
install_if="tree-sitter-grammars"
source="$pkgname-$pkgver.tar.gz::https://github.com/ObserverOfTime/tree-sitter-xml/archive/refs/tags/v$pkgver.tar.gz"
options="!check"  # no tests for shared lib

_langs='xml dtd'

build() {
	local lang; for lang in $_langs; do
		abuild-tree-sitter build -s "$lang/src"
	done
}

package() {
	local lang; for lang in $_langs; do
		DESTDIR="$pkgdir" abuild-tree-sitter install -s "$lang/src" -q "$lang/queries"
	done
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
26362ca59760db8b3a43058784f348a9e7e1ac1d79786581c48e1e77d8988055a95daf45e9c7e833186ec3d85ae1c97c0f11802fceb2fb8741a4ed952b304209  tree-sitter-xml-0.6.4.tar.gz
"
